package com.shuijing.boot.utils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.env.Environment;


public class StartupRunner {
    private static final Logger logger = LoggerFactory.getLogger(StartupRunner.class);

    public static void printBanner(Environment environment, String contextPath) {
        String name = environment.getProperty("spring.application.name");
        String port = environment.getProperty("server.port", "8080");
        String fullUrl = "http://localhost:" + port + contextPath;
        logger.info("************************************************************");
        logger.info("* 应用 {} 启动成功", name);
        logger.info("* 访问地址: {}", fullUrl);
        logger.info("************************************************************");
        System.out.println("********** 启动完成 **********");
    }
}